
const core = new GameEngineCore();
setTimeout(function () {
    core.start();
}, 1000);


function ease(advancedTime, totalTime) {

    // return Math.sin(advancedTime / totalTime * Math.PI) + 1;
    let scale = advancedTime / totalTime;
    if (scale > 1) {
        scale = 1;
    }
    return scale;
}

const radius = 10;
var  imp_movedown = true;

const img1 = new ImageRenderer();
const img2 = new ImageRenderer();
const img3 = new ImageRenderer();
const img4 = new ImageRenderer();
const img5 = new ImageRenderer();
const img6 = new ImageRenderer();

const backGround = new drawBackGoound();
const leftText = new drawText();
const rightText = new drawText();
const redImp = new drawImp();
const orangeImp = new drawImp();
const pinkImp = new drawImp();
const yellowImp = new drawImp();
const purpleImp = new drawImp();
const rightTR = new drawRTR();
const leftTR = new drawLTR();
const rightConcava = new drawRConcave();
const leftConcava = new drawLConcave();
const downT = new drawDT();
const upT = new drawUT();
const rightT = new drawRT();
const leftT = new drawLT();
const player = new drawPlayer();
//const middleRR = new drawMRR();

const otherRender = new drawOther();

const roundR1 = new drawRR();
const roundR2 = new drawRR();
const roundR3 = new drawRR();
const roundR4 = new drawRR();
const roundR5 = new drawRR();
const roundR6 = new drawRR();
const roundR7 = new drawRR();
const roundR8 = new drawRR();
const roundR9 = new drawRR();

core.onStart = function () {

     backGround.color="black";

     leftText.x=15;
     leftText.y=200;
     leftText.text="Pac Man";
     leftText.color="yellow";

     rightText.x=320;
     rightText.y=200;
     rightText.text="Round 5";
     rightText.color="yellow";
    
     redImp.x=175;
     redImp.y=200;
     redImp.righteye=2;
     redImp.lefteye=-6;
     redImp.color="red";

     orangeImp.x=200;
     orangeImp.y=200;
     orangeImp.righteye=-2;
     orangeImp.lefteye=2;
     orangeImp.color="orange";
     
     pinkImp.x=225;
     pinkImp.y=196;
     pinkImp.righteye=8;
     pinkImp.lefteye=0;
     pinkImp.color="pink";

     yellowImp.x=175;
     yellowImp.y=30;
     yellowImp.righteye=-8;
     yellowImp.lefteye=0;
     yellowImp.color="yellow";

     purpleImp.x=254;
     purpleImp.y=170;
     purpleImp.righteye=-8;
     purpleImp.lefteye=2;
     purpleImp.color="purple";

     rightTR.x=275;
     rightTR.y=340;
     rightTR.color="blue";

     leftTR.x=125;
     leftTR.y=340;
     leftTR.color="blue";
     
     rightConcava.x=320;
     rightConcava.y=320;
     rightConcava.color="blue";

     leftConcava.x=80;
     leftConcava.y=320;
     leftConcava.color="blue";
     
     downT.x=200;
     downT.y=100;
     downT.color="blue";

     upT.x=200;
     upT.y=360;
     upT.color="blue";

     rightT.x=125;
     rightT.y=140;
     rightT.color="blue";

     leftT.x=275;
     leftT.y=140;
     leftT.color="blue";

     player.x=25;
     player.y=25;
     player.color="yellow";

     roundR1.x=200;
     roundR1.y=270;
     roundR1.w=80;
     roundR1.l=20;
     roundR1.color="blue";

     roundR2.x=65;
     roundR2.y=50;
     roundR2.w=60;
     roundR2.l=30;
     roundR2.color="blue";

     roundR3.x=140;
     roundR3.y=50;
     roundR3.w=40;
     roundR3.l=30;
     roundR3.color="blue";

     roundR4.x=260;
     roundR4.y=50;
     roundR4.w=40;
     roundR4.l=30;
     roundR4.color="blue";

     roundR5.x=335;
     roundR5.y=50;
     roundR5.w=60;
     roundR5.l=30;
     roundR5.color="blue";

     roundR6.x=65;
     roundR6.y=100;
     roundR6.w=60;
     roundR6.l=20;
     roundR6.color="blue";

     roundR7.x=335;
     roundR7.y=100;
     roundR7.w=60;
     roundR7.l=20;
     roundR7.color="blue";

     roundR8.x=125;
     roundR8.y=250;
     roundR8.w=20;
     roundR8.l=60;
     roundR8.color="blue";
 
     roundR9.x=275;
     roundR9.y=250;
     roundR9.w=20;
     roundR9.l=60;
     roundR9.color="blue";

     img1.image=getImageUrl('../image/tex2.jpg');
     img1.x=225;
     img1.y=210;
     img1.w=70;
     img1.l=120;

     img2.image=getImageUrl('../image/tex1.jpg');
     img2.x=115;
     img2.y=210;
     img2.w=70;
     img2.l=130;

     img3.image=getImageUrl('../image/tex1.jpg');   
     img3.x=235;
     img3.y=90;
     img3.w=70;
     img3.l=120; 

     img4.image=getImageUrl('../image/tex2.jpg');
     img4.x=105;
     img4.y=90;
     img4.w=70;
     img4.l=130; 

     img5.image=getImageUrl('../image/tex3.jpg');
     img5.x=160;
     img5.y=250;
     img5.w=80;
     img5.l=140; 

     img6.image=getImageUrl('../image/tex4.jpg');
     img6.x=160;
     img6.y=50;
     img6.w=80;
     img6.l=140; 

    core.renderList = [
        backGround,
        roundR1,roundR2,roundR3,roundR4,roundR5,roundR6,roundR7,roundR8,roundR9,
        player,leftT,rightT,upT,downT,leftConcava,rightConcava,leftTR,rightTR, 
        purpleImp,yellowImp,pinkImp,orangeImp,redImp,
        rightText,leftText,
        otherRender, 
        img1,img2,img3,img4,img5,img6
    ];
}


core.onUpdate = function () {

     
     
}


